package com.senmo.model;

import com.google.gson.annotations.Expose;

import java.util.ArrayList;

/**
 * author: lx
 * date: 16-1-5
 */
public class DeviceModel {

    public static final int TYPE_SELF = 1;
    public static final int TYPE_OTHER = 2;

    @Expose
    public String device_id;

    @Expose
    public String device_name;

    @Expose
    public int value;

    public ArrayList<ChannelModel> channels;

    public boolean isOwnedBySelf() {
        return value == TYPE_SELF;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DeviceModel that = (DeviceModel) o;

        return !(device_id != null ? !device_id.equals(that.device_id) : that.device_id != null);

    }

    @Override
    public int hashCode() {
        return device_id != null ? device_id.hashCode() : 0;
    }
}
